package com.demo.netty.use.sample;

import io.netty.bootstrap.ServerBootstrap;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.serialization.ObjectEncoder;
import org.junit.Test;
import org.springframework.boot.autoconfigure.security.SecurityProperties;

public class HelloNetty {


    @Test
    public void helloNetty() {

        ServerBootstrap serverBootstrap = new ServerBootstrap();
//        serverBootstrap.group()


    }

    @Test
    public void bufferTest() {
        ByteBuf byteBuf = Unpooled.directBuffer(100, 1024);
        byteBuf.writeInt(1000);
        System.out.println(byteBuf.isReadable());
        int i = byteBuf.readInt();
        ByteBuf buf = byteBuf.setIndex(1, 30);
        int anInt = buf.getInt(0);
        System.out.println(anInt);
        System.out.println(i);
    }

    @Test
    public void encode01() {
        SecurityProperties.User user = new SecurityProperties.User();
        user.setName("xxxx");
        user.setPassword("jack");
        ObjectEncoder encoder = new ObjectEncoder();

    }
}
